package com.example.mobile2021606159yhf0406;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    private TextView tvMainTitle;
    private RadioGroup radGupCarType;
    private RadioButton radBtnMainSaloon;
    private RadioButton radBtnMainMPV;
    private RadioButton radBtnMainSUV;
    private RadioGroup radGupCarLine;
    private RadioButton radBtnMainLine1;
    private RadioButton radBtnMainLine2;
    private RadioButton radBtnMainLine3;
    private RadioButton radBtnMainLine4;
    private Button btnMainCreate;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        radGupCarType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int i) {
                RadioButton radioButton = findViewById(i);
                Log.i("RadioButton",radioButton.getText().toString());
            }
        });
    }
    private void initView(){
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        radGupCarType = (RadioGroup) findViewById(R.id.radGup_car_type);
        radBtnMainSaloon = (RadioButton) findViewById(R.id.radBtn_main_saloon);
        radBtnMainMPV = (RadioButton) findViewById(R.id.radBtn_main_MPV);
        radBtnMainSUV = (RadioButton) findViewById(R.id.radBtn_main_SUV);
        radGupCarLine = (RadioGroup) findViewById(R.id.radGup_main_line);
        radBtnMainLine1 = (RadioButton) findViewById(R.id.radBtn_main_line1);
        radBtnMainLine2 = (RadioButton) findViewById(R.id.radBtn_main_line2);
        radBtnMainLine3 = (RadioButton) findViewById(R.id.radBtn_main_line3);
        radBtnMainLine4 = (RadioButton) findViewById(R.id.radBtn_main_line4);
        btnMainCreate = (Button) findViewById(R.id.btn_main_create);

    }
}